﻿using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {

	public float walk = 3.0f; 	// Walk speed
	public float run = 1.5f; 	// Run speed calculate => run_speed = walk * run;
	public float rotate = 0.3f; // Rotation to left or right

	// Use this for initialization
	void Start () {
		// Player Spawn Point
		transform.position = new Vector3 (43, 0, 100);
	}
	
	// Update is called once per frame
	void Update () {

		// Player move forward/backward/left/right/
		if (Input.GetKey (KeyCode.W)) {
			animation.Play("walk");
			transform.Translate (Vector3.forward * walk * Time.deltaTime);
		} else if(Input.GetKey (KeyCode.S)) {
			animation.Play("walk");
			transform.Translate (Vector3.back * walk * Time.deltaTime);
		} else {
			animation.Play("stand");
		}

		if(Input.GetKey (KeyCode.D)) {
			transform.Rotate (new Vector3 (0f, 45f, 0f) * Time.deltaTime);
		} else if(Input.GetKey (KeyCode.A)) {
			transform.Rotate (new Vector3 (0f, -45f, 0f) * Time.deltaTime);
		}
	}
}
